package k2_oop.p8_javaUtil;

import java.text.SimpleDateFormat;
import java.util.Date;

public class UseDate {
    public static void main(String[] args) throws Exception {

//        long currentTime = System.currentTimeMillis();
//        System.out.println(currentTime);
//
//        try {
//            Thread.sleep(10000);
//        } catch (InterruptedException e) {
//            throw new RuntimeException(e);
//        }

        Date date = new Date();
        System.out.println(date);
//
//        Date dateOld = new Date(currentTime);
//        System.out.println(dateOld);
//
        Date date2 = new Date(2000-1900,0,1,16,0,0);
        System.out.println(date2);


//        System.out.println(date.getYear()+1900);
//        System.out.println(date.getMonth()+1);
//        System.out.println(date.getDate());
//        System.out.println(date.getDay());
//        System.out.println(date.getHours());
//        System.out.println(date.getMinutes());
//        System.out.println(date.getSeconds());
//        System.out.println(date.getTime());
//
//        date.setYear(3000-1900);
//        date.setMonth(5-1);
//        date.setDate(1);
//        date.setHours(10);
//        date.setMinutes(10);
//        date.setSeconds(10);
//
//        System.out.println(date);

//        System.out.println(date.before(date2));
//        System.out.println(date.after(date2));
//        System.out.println(date.equals(date2));
//        System.out.println(date2.compareTo(date2));

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dataStr = sdf.format(date2);
        System.out.println(dataStr);

        String dateStr1 = "2050/10/1 1:08";
        SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/MM/dd HH:mm");
        Date date3 = sdf1.parse(dateStr1);
        System.out.println(date3);


    }
}
